<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
        <title>File upload form</title>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
		<script language="javascript">
				jQuery(document).ready(function(){
						jQuery('#email_file').change(function(){
								try {
									parent.didFileSelected($(this).val());
								} catch(err){alert(err.message);}
						});
				});
		</script>
	</head>
	<body style="background-color:#f6f6f6;">
		<?php
				if(isset($error))
				{
						echo "<script language=\"javascript\">parent.didUploadError('".json_encode(array('error'=>$error))."');</script>";
				}
				elseif(isset($upload_data))
				{
						echo "<script language=\"javascript\">parent.didUploadDone('".json_encode($upload_data)."');</script>";
				}
				
				$this->load->helper('form');
				echo form_open_multipart('admin/upload_email_file', array('id' => 'upload_form'));
				echo '<input type="hidden" id="token" name="token" value="" />';
				echo form_upload(array(
						'name'        => 'email_file',
						'id'          => 'email_file',
				));
				echo form_close();
				die();
		?>
	</body>
</html>
